POV-Ray : Newsgroups : povray.general : Help: Place objects within a circle : Re: Place objects within a circle Server Time
4 Aug 2024 00:25:20 EDT (-0400)
  Re: Place objects within a circle  
From: Slime
Date: 11 Sep 2003 23:10:21
Message: <3f61391d$1@news.povray.org>
> Well it took writing this message to figure out that I can place the
> object randomly on the x radious and then randomly rotate it arround the
> y, it will always remain within the circle.
>
> Am I on the right track here?


Yes. However, if you do that, you'll find that there's one problem with it:
the objects will be more dense at the center of the circle than at the edge.
This is because each X-coordinate has an equal likelihood of being chosen,
but the ones closer to zero get put in a smaller area (a small circle) than
those closer to the radius of the circle.

To counteract this, you need to "pull" the objects closer to the outer edge
of the circle. The correct way to do this involves calculus (I think), but
I'm pretty sure that it will turn out that you want to take the square root
of the X-value you get.

So:

x = random value from 0 to 1
x = sqrt(x)
x = x * radius of circle
final position = x coordinate rotated randomly around origin

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.